<% unless @role.new_record? %>
    <script>
        window.role_id = <%= @role.id %>
    </script>
<% end %>
<%= simple_form_for([:admin, @role], html: {class: 'form-horizontal form-show', id: 'role_form'}) do |f| %>
    <%= f.error_notification %>
    <div class="row">
      <div class="col-xs-8">
        <%= f.input :name, required: true %>
        <%= f.input :description %>
        <%= f.input :position %>
      </div>

      <div class="col-xs-4">
        <div class="base-border" style="margin-top: 0px;">
          <label class="base-border-after">选择权限</label>

          <div style="max-height:265px; overflow: auto;">
            <ul id='permission_tree' class='ztree'></ul>
          </div>
        </div>
        <div id='permissions_div' class='hidden'></div>
      </div>
    </div>

    <div class="clearfix form-actions">
      <div class="col-md-offset-3 col-md-9">
        <%= f.button :submit, class: 'btn btn-primary' %>
      </div>
    </div>
<% end %>

<%= javascript_include_tag 'roles/form' %>